* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

h1 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 2.5rem;
    font-weight: 700;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

#directoryInput {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    min-width: 300px;
    transition: border-color 0.3s ease;
}

#directoryInput:focus {
    outline: none;
    border-color: #667eea;
}

button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: 600;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

.info {
    text-align: center;
    color: #718096;
    font-weight: 500;
}

main {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.image-wall {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.image-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.image-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.image-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-item:hover img {
    transform: scale(1.05);
}

.image-info {
    padding: 15px;
}

.image-info h3 {
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 5px;
    word-break: break-word;
}

.image-info p {
    font-size: 12px;
    color: #718096;
}

.no-images {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

.no-images h2 {
    font-size: 2rem;
    margin-bottom: 20px;
}

.no-images p {
    font-size: 1.1rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.hidden {
    display: none !important;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.close:hover {
    background: rgba(0, 0, 0, 0.7);
}

#modalImage {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
}

.modal-info {
    padding: 20px;
}

.modal-info h3 {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 10px;
}

.modal-info p {
    color: #718096;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    #directoryInput {
        min-width: 250px;
        width: 100%;
        max-width: 400px;
    }
    
    .image-wall {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .image-wall {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .image-item img {
        height: 150px;
    }
}
